package com.je21121.model;

public class MyPage {
    private int curpage = 1;// 当前页
    private int maxpage ;// 最大页
    private int maxcount; // 查询得到的最大记录数
    private int prepage;// 上一页
    private int nextpage;// 下一页
    private int pagecount = 2;// 每页记录数

    public int getCurpage() {
        return curpage;
    }

    public void setCurpage(int curpage) {
        // 当前页不能小于1 不能大于最大页
        if(curpage < 1){
            this.curpage = 1;
        }else if(curpage > maxpage){
            this.curpage = maxpage;
        }else{
            this.curpage = curpage;
        }
    }

    public int getMaxpage() {
        return maxpage;
    }

    public void setMaxpage(int maxpage) {
        this.maxpage = maxpage;
    }

    public int getMaxcount() {
        return maxcount;
    }

    public void setMaxcount(int maxcount) {
        this.maxcount = maxcount;
        //  计算最大页
        if(maxcount%this.pagecount == 0){  //   最大记录数 10   每页显示记录数 2   =  总页数 5
            this.maxpage = maxcount/this.pagecount;
        }else{   // 11  2   =  5+1
            this.maxpage = maxcount/this.pagecount + 1;
        }
    }

    public int getPrepage() {
        return prepage;
    }

    public void setPrepage(int prepage) {
        this.prepage = prepage;
    }

    public int getNextpage() {
        return nextpage;
    }

    public void setNextpage(int nextpage) {
        this.nextpage = nextpage;
    }

    public int getPagecount() {
        return pagecount;
    }

    public void setPagecount(int pagecount) {
        this.pagecount = pagecount;
    }
}
